// this script is set up in the manifest to get triggered everytime the url of a tab changes

// tablink is the url of the tab
var tablink = document.location.href;

var thisisagoogledoc=false;

//check if the url is a google docs document
if(tablink.indexOf("://docs.google.com")>=0 ||tablink.indexOf("://docs0.google.com")>=0)
{

	if(tablink.indexOf("id=")>0)
	{
		thisisagoogledoc=true;
	}
	else if(tablink.indexOf("/document/d/")>0)
	{
		thisisagoogledoc=true;
	}

}



if(thisisagoogledoc==true)
{
	// send a message to the background page to say it url is a google doc
	chrome.extension.sendRequest({activate: 'true'});			

}
else
{	
	// send a message to the background page to say it url is NOT a google doc
	chrome.extension.sendRequest({activate: 'false'});			
}		
